#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "parser.h"
#include "debug.h"

void list_http_server(const struct conf_http_server *const server) {
  printf("\033[0;30;42mlistening: %d\033[0m\n", server->listen);
  printf("\033[0;30;42mserver name: %s\033[0m\n", server->server_name);
  printf("\033[0;30;42mfrom: %s\033[0m\n", server->location.from);
  printf("\033[0;30;42mto: %s\033[0m\n", server->location.map_to);
  printf("\033[0;30;42mtype: %s\033[0m\n", (server->location.type==SERVER_ROOT?"root":"proxy_pass"));
}

void list_http(const struct conf_http *const http) {
  for(int i=0; i<http->server_num; ++i) {
    list_http_server(http->servers[i]);
  }
}

